package b_object;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package b_object
 * @date 2024/4/1 下午12:50
 */
public class Test02 {
    public static void main(String[] args) {
        Person p1 = new Person("金莲",18);
        Person p2 = new Person("金莲",18);
        System.out.println(p1==p2);//比较地址值是否相等：false
        System.out.println(p1.equals(p2));//比较地址值是否相等：false

        System.out.println("==================================");
        String S1=new String("金莲");
        String S2=new String("金莲");
        System.out.println(S1==S2);//比较地址值是否相等：false
        System.out.println(S1.equals(S2));//比较地址值是否相等：true   //重写之后的equals
    }
}
